<!DOCTYPE html>
<html>
<head>
	<title>点大设置等级</title>
    <link rel="stylesheet" href="/layui/css/layui.css">
	<link rel="stylesheet" href="/hyqcss/public.css">
</head>
<body>
	<form id="form1" class="layui-form" action="">
		<h3 style="text-align: center;padding-bottom: 20px;padding-left: 32px;font-weight: bold;font-size: 20px;">设置等级</h3>
		<div class="item" style="">
			<div class="layui-form-item">
		    	<label class="layui-form-label">是否开启</label>
		    	<div class="layui-input-block">
		      		<input type="checkbox" name="status" lay-skin="switch" lay-filter="pb_setlevel" {if $setlevel->status}checked{/if}>
		    	</div>
			</div> 
		</div>
		<div class="item" style="">
			<div class="layui-form-item">
			    <label class="layui-form-label">会员等级</label>
			    <div class="layui-input-block">
			      <select name="levelId">
			        {loop $pbLevels as $level}
			        <option value="{$level['id']}" {if $setlevel->level_id == $level['id']}selected{/if}>{$level['name']}--{$level['discount']/1 == 10 ? '无折扣' : ($level['discount']/1).'折'}</option>
			        {/loop}
			      </select>
			    </div>
			 </div>
	    </div>
	    <div class="item" style="">
			<div class="layui-form-item">
				<label class="layui-form-label">有效期</label>
				<div class="layui-input-inline">
					<input type="text" name="endtime" id="date" value="{$setlevel->endtime?date('Y-m-d H:i:s',$setlevel->endtime):''}" placeholder="" autocomplete="off" class="layui-input">
				</div>
	    	</div>
	    </div>
	    <div class="layui-form-item" style="margin-left: 108px;color: #999999;font-size: 12px;">开启后将通过「企微助手」提醒员工通过该手机号添加客户</div>
	    <div class="layui-form-item">
		    <div class="layui-input-block">
		       <a class="layui-btn layui-btn-primary" onclick="parent.layer.closeAll()">取消</a>
		       <a class="layui-btn" lay-submit="" lay-filter="demo1">确定</a>
		    </div>
		</div>
	</form>
</body>
<script src="/cdn/jquery.js"></script>
<script src="/layui/layui.js"></script>
<script src="/js/ajax.js"></script>
<script type="text/javascript">
	layui.use(['form', 'layedit', 'laydate'], function(){
	  var form = layui.form
	  ,layer = layui.layer
	  ,laydate = layui.laydate;

		laydate.render({
		    elem: '#date'
		    ,type: 'datetime'
		  });

		//监听提交
		form.on('submit(demo1)', function(data){

			var formData = $('#form1').serialize();	
			myAjaxPost(false, true, '', formData, function (resp) {
				console.log(resp);
				if (resp.status == 'success') {
					tusi(resp.msg);
					parent.layer.closeAll()
				}else{
					alert(resp.msg);
				}
			});
		});
	})
</script>
</html>
